package com.dinnerwithfriends.client.dinner.invite;

import com.dinnerwithfriends.client.GWTEntryPoint;
import com.dinnerwithfriends.client.emails.SendEmail;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;



/** 
 * 
 * 
 * @
 * @Feature 
 */

public class PreviewDinner {

	public PreviewDinner() {

		String message = "Restaurant: <b>"
				+ CreateDinner.textBoxRestaurant.getValue() + "</b><br><br>"
				+ "Dates & Times: <b>" + CreateDinner.dateBox1.getValue()
				+ "  // " + CreateDinner.dateBox2.getValue() + "</b><br><br>"
				+ "Friends: <b>" + CreateDinner.selectedFriends.toString()
				+ "</b><br><br>" + "Extra Message: <b>"
				+ CreateDinner.textAreaMessage.getValue() + "</b><br><br>"
				+ "Pre-paid: <b>" + CreateDinner.chckbxPrepaid.getValue()
				+ "</b><br><br>" + "Option: <b>" + getPostOptions() + "</b>";

		new SendEmail("PREVIEW " + message);

		RootPanel rootPanel = RootPanel.get();

		rootPanel.clear();

		HTML lblDinnerWith = new HTML(
				"<font size=5 color='gray'>::: DINNER WITH FRIENDS :::</font>");
		rootPanel.add(lblDinnerWith, 53, 10);
		lblDinnerWith.setSize("385px", "66px");

		HTML lblThisEventIs = new HTML("Thanks <b>"
				+ GWTEntryPoint.loginInfo.getNickname()
				+ "</b> for using Dinner With Friends!");
		rootPanel.add(lblThisEventIs, 38, 82);

		HTML userLabel = new HTML("Your dinner was spread!");
		rootPanel.add(userLabel, 38, 116);
		userLabel.setSize("469px", "36px");

		HTML hprlnkRestaurant = new HTML(message);
		rootPanel.add(hprlnkRestaurant, 43, 176);

	}

	private String getPostOptions() {

		String options = "<br>";

		if (CreateDinner.chckbxSendEmails.getValue()) {
			options += CreateDinner.chckbxSendEmails.getText() + "<br>";
		}

		if (CreateDinner.chckbxTweet.getValue()) {
			options += CreateDinner.chckbxTweet.getText() + "<br>";
		}

		if (CreateDinner.chckbxSendFacebookMessages.getValue()) {
			options += CreateDinner.chckbxSendFacebookMessages.getText()
					+ "<br>";
		}

		if (CreateDinner.chckbxPostOnMy.getValue()) {
			options += CreateDinner.chckbxPostOnMy.getText() + "<br>";
		}

		if (CreateDinner.chckbxPostOnFriends.getValue()) {
			options += CreateDinner.chckbxPostOnFriends.getText() + "<br>";
		}

		return options;
	}
}
